import 'package:flutterapp/models/BannerData.dart';
import 'package:flutterapp/models/WxarticleListEntity.dart';
import 'package:flutterapp/models/article_list/ArticleListDataModel.dart';

class EntityFactory {
  static T generateOBJ<T>(json) {
    if (json == null) {
      return null;
    }
    //可以在这里加入任何需要并且可以转换的类型，例如下面
    else if (T.toString() == "WxarticleListEntity") {
      return WxarticleListEntity.fromJson(json) as T;
    } else if (T.toString() == "BannerData") {
      return BannerData.fromJson(json) as T;
    }else if(T.toString()=="ArticleListDataModel"){
      return ArticleListDataModel.fromJson(json) as T;
    }
    else {
      return json.decode(json) as T;
    }
  }
}
